package cn.ihuizi.service.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.sun.org.apache.bcel.internal.generic.NEW;

import cn.ihuizi.dao.PowerDao;
import cn.ihuizi.dao.impl.PowerDaoImpl;
import cn.ihuizi.entity.Admin;
import cn.ihuizi.entity.Power;
import cn.ihuizi.service.PowerService;
import jdk.nashorn.internal.objects.annotations.Where;

public class PowerServiceImpl implements PowerService{
	PowerDao powerDao = new PowerDaoImpl();
	@Override
	public List AdminPowerId(Admin admin) {
		// TODO Auto-generated method stub
		ResultSet rs = powerDao.AdminPowerId(admin);
		List<Integer> list = new ArrayList();
		try {
			while (rs.next()) {
				int power_id = rs.getInt(1);
				list.add(power_id);
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println(list);
		return list;
	}

	@Override
	public boolean InsertPower(Power power) {
		// TODO Auto-generated method stub
		int i = powerDao.InsertPower(power);
		if(i>0) return true;
		return false;
	}

}
